<?php
namespace Rainrock\Framework\Controller;


use Rainrock\Framework\kernel\core\Controller;
use Rainrock\Framework\kernel\base\Request;
use Rainrock\Framework\kernel\base\CDate;
use Rainrock\Framework\kernel\base\Rock;
use Rainrock\Framework\kernel\base\Base;
use Rainrock\Framework\kernel\Html\HtmlBase;
use Rainrock\Framework\kernel\Html\HtmlLabel;
use Rainrock\Framework\kernel\Html\HtmlButton;

/**
*	首页
*/
class IndexController extends Controller{
	
	public function indexAction()
	{
		$html = HtmlBase::get();
		$html->setTitle('欢迎使用');
		
		$sdiv  = HtmlLabel::get()
			->setBackgroundColor(APPTHEME)
			->setWidth('60px')
			->setHeight('60px')
			->setRadius('50%')
			->addStyle('line-height','50px')
			->setFontsize(30)
			->setFontcolor('white')
			->addCont('✔');
		
		
		$mdivs = HtmlLabel::get()->setAlign('left')
				->addBlank(10)
				->addCont(HtmlLabel::get()->setAlign('center')->addCont($sdiv))
				->addBlank(20)
				->addCont(HtmlLabel::get()->setAlign('center')->addCont('看到这个页面说明框架运行成功'))
				->addBlank(10)
				->addCont(HtmlLabel::get()
					->addCont(HtmlLabel::get('font')->addCss('hui')->addCont('我的IP：'))
					->addCont(Request::getIp())
				)
				->addBlank(5)
				->addCont(HtmlLabel::get()
					->addCont(HtmlLabel::get('font')->addCss('hui')->addCont('当前时间：'))
					->addCont(Rock::now())
				)
				->addBlank(5)
				->addCont(HtmlLabel::get()
					->addCont(HtmlLabel::get('font')->addCss('hui')->addCont('相关文档：'))
					->addCont(HtmlLabel::get('a')->addCont('查看文档')->setIsnew(true)->setHref(''.URLY.'view_framework.html'))
				)
				->addBlank(5)
				->addCont(HtmlLabel::get()
					->addCont(HtmlLabel::get('font')->addCss('hui')->addCont('开发作者：'))
					->addCont('雨中磐石')
				)
				->addBlank(5)
				->addCont(HtmlLabel::get()
					->addCont(HtmlLabel::get('font')->addCss('hui')->addCont('官网主页：'))
					->addCont(HtmlLabel::get('a')->addCont(URLY)->setIsnew(true)->setHref(URLY))
				)
				->addBlank(15)
				->addCont(HtmlLabel::get()->setAlign('center')
					->addCont(HtmlLabel::get('font')->addCss('hui')->setFontsize(14)->addCont('样式异常请点下面按钮在刷新'))
				)
				->addBlank(10)
				->setWidth('300px')
				->addCss('border')
				->setBackgroundColor('var(--main-bgcolor)')
				->setRadius(5)
				->addStyle('margin-top','20px')
				->addStyle('padding','10px');
		
		$html->addBody(HtmlLabel::get('h2')->addStyle('margin-top','30px')->addCont(TITLE));
		$html->addBody($mdivs);
		
		$fdiv = HtmlLabel::get()->addStyle('margin-top','20px');
		$fdiv->addCont(HtmlLabel::get('a')
			->setDisplay('block')
			->addStyle('text-align','center')
			->setWidth('130px')
			->addCss('webbtn')
			->setHref('?m=dbmanage')
			->addCont('进入模块管理')
		);
		
		$btn1 = HtmlLabel::get('a')
			->addStyle('text-align','center')
			->addCss('webbtn')
			->addCss('webbtn-main')
			->setHref('?m=login')
			->addCont('登录后台');
		
		$btn2 = HtmlLabel::get('a')
			->addStyle('text-align','center')
			->addCss('webbtn')
			->addCss('webbtn-main')
			->setIsnew(true)
			->setHref('?m=webstatic&a=update')
			->addCont('样式异常点我');		
		
		$fdiv->addCont(HtmlLabel::get()
			->addStyle('margin-top','25px')
			->addStyle('margin-bottom','30px')
			->addCont($btn1)
			->addKong()
			->addKong()
			->addCont($btn2)
		);
		
		
		
		
		
		$html->addBody($fdiv);
		$html->addFBody(PublicViews::Footer(13));
		
		return $html->show();
	}
	
	
	public function testAction()
	{
		return MsgView::Success('看到这个说明页面可用','返回','javascript:js.back()');
	}
	
	public function abcAction()
	{
		//Rock::createLog($_SERVER, 'server');
	}
}